﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace AJWPFAdmin.Services.Migrations
{
    /// <inheritdoc />
    public partial class 新增手动开闸记录表 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "AutoVideoCaptureINValue",
                table: "Devices",
                type: "longtext",
                nullable: true,
                comment: "自动触发录像相机IN值")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<bool>(
                name: "EnableVideoCapture",
                table: "Devices",
                type: "tinyint(1)",
                nullable: false,
                defaultValue: false,
                comment: "是否启用手动开闸录像");

            migrationBuilder.AddColumn<double>(
                name: "VideoDuration",
                table: "Devices",
                type: "double",
                nullable: true,
                comment: "录像时长(秒)");

            migrationBuilder.CreateTable(
                name: "ManualPassRecords",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false),
                    WatchhouseId = table.Column<long>(type: "bigint", nullable: false, comment: "岗亭/入口id"),
                    WatchhouseCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "岗亭/入口编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    WatchhouseName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "岗亭/入口名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PassagewayId = table.Column<long>(type: "bigint", nullable: false, comment: "通道(道闸)id"),
                    PassagewayCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "通道(道闸)编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PassagewayName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "通道(道闸)名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Direction = table.Column<short>(type: "smallint", nullable: false, comment: "方向"),
                    DeviceId = table.Column<long>(type: "bigint", nullable: false, comment: "关联设备Id"),
                    DeviceCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "关联设备编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeviceName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "关联设备名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VideoStoreDirectory = table.Column<string>(type: "longtext", nullable: true, comment: "录像文件存储目录")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PId = table.Column<int>(type: "int", nullable: false),
                    CreateDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    UpdateDate = table.Column<DateTime>(type: "datetime(6)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ManualPassRecords", x => x.Id);
                },
                comment: "手动开闸出入记录表")
                .Annotation("MySql:CharSet", "utf8mb4");

            
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "ManualPassRecords");

            migrationBuilder.DropColumn(
                name: "AutoVideoCaptureINValue",
                table: "Devices");

            migrationBuilder.DropColumn(
                name: "EnableVideoCapture",
                table: "Devices");

            migrationBuilder.DropColumn(
                name: "VideoDuration",
                table: "Devices");

            
        }
    }
}
